package com.ht.medicaltreatment.adapter

import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.bean.Drawblood

class DialogReplaceAdapter:BaseQuickAdapter<Drawblood,BaseViewHolder>(R.layout.item_replace_layout) {
    override fun convert(holder: BaseViewHolder, item: Drawblood) {
        val text = holder.getView<TextView>(R.id.tvname)
        val imgCheck = holder.getView<ImageView>(R.id.imgCheck)
        text.setText(item.name)
        if(item.isChecked){
            imgCheck.visibility = View.VISIBLE
            text.setTextColor(context.getColor(R.color.orange))
            text.setBackgroundResource(R.drawable.shape_dialog_replace_item_bg)
        }else{
            imgCheck.visibility = View.GONE
            text.setTextColor(context.getColor(R.color.black33))
            text.setBackgroundResource(R.drawable.shape_dialog_replace_item_orange)
        }
    }

}
